package com.yidu.manage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yidu.common.utils.MD5Util;
import com.yidu.manage.domain.SysUser;
import com.yidu.manage.mapper.TSysUserMapper;
import com.yidu.manage.service.ITSysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-04-06
 */
@Service
public class TSysUserServiceImpl extends ServiceImpl<TSysUserMapper, SysUser> implements ITSysUserService
{
    @Autowired
    private TSysUserMapper sysUserMapper;

    @Override
    public SysUser login(String username, String password)
    {
        QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);
        // MD5Util.password(password)
        wrapper.eq("password", password);
        wrapper.select("username", "nickname", "email", "phone", "sex", "avatar");
        return this.getOne(wrapper);
    }
}
